package org.jks.service;

import java.util.List;

import org.jks.model.DeviceRe;
import org.springframework.stereotype.Service;

@Service
public class DeviceReService extends EntityService<DeviceRe>{
	
	public DeviceReService(){
		MODEL_NAME = DeviceRe.class.getSimpleName();
		CLASS_NAME = DeviceRe.class;
	}
	
	public List<DeviceRe> search(String startTime, String endTime){
		String hql = "from " + MODEL_NAME + " where 1=1";
		if(startTime != null && startTime.length() > 0){
			hql += " and FlightTime >= '" + startTime + " 00:00:00'";
		}
		if(endTime != null && endTime.length() > 0){
			hql += " and FlightTime <= '" + endTime + " 23:59:59'";
		}
		return find(hql);
	}
}